<template>
  <div>
    <h1>测试axios的二次封装</h1>
  </div>
</template>

<script setup lang="ts">
import request from '@/utils/request'
import { onMounted } from 'vue'

// 当组件一挂载的时候发送一个请求
onMounted(() => {
  request({
    // 不要写/api
    url: '/user/login',
    method: 'POST',
    data: {
      username: 'admin',
      password: '111111',
    },
  }).then((res) => {
    console.log(res)
  })
})
</script>

<style lang="scss" scoped></style>
